using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using QLKS.DataLayer.BusinessObjects;
using QLKS.DataLayer.Base;

namespace QLKS.DataLayer.ManagerObjects
{
    public partial interface ILoaiKhachManager : IManagerBase<LoaiKhach, int>
    {
		// Get Methods
		LoaiKhach GetByTenLoaiKhach(System.String tenLoaiKhach);
    }

    partial class LoaiKhachManager : ManagerBase<LoaiKhach, int>, ILoaiKhachManager
    {
		#region Constructors
		
		public LoaiKhachManager() : base()
        {
        }
        public LoaiKhachManager(INHibernateSession session) : base(session)
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public LoaiKhach GetByTenLoaiKhach(System.String tenLoaiKhach)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(LoaiKhach));
			
			
			criteria.Add(NHibernate.Criterion.Expression.Eq("TenLoaiKhach", tenLoaiKhach));
			
			IList<LoaiKhach> result = criteria.List<LoaiKhach>();
			return (result.Count > 0) ? result[0] : null;
        }
		
		#endregion
    }
}